<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    <script type="text/javascript" src="./public/js/jquery.js"></script>
	<?php
		$default_js[] = './public/js/json.js';
		$default_js[] = './public/js/base64.js';
		$default_js[] = './public/js/jquery.cookie.js';
        $default_js[] = './public/js/jquery.easing.js';
		$default_js[] = './public/js/base.js';
	?>
	<script type="text/javascript" src="{script $default_js}"></script>
	<?php
		$current_css[] = './tpl/css/base.css';
		$current_css[] = './tpl/css/lightbox.css';
	?>
	<link rel="stylesheet" type="text/css" href="{css $current_css}" media="all"/>
    <script type="text/javascript">
		var SITE_PATH = '$_FANWE[site_root]';
		var SITE_URL = '$_FANWE[site_url]';
		var TPL_PATH = '{TPL_PATH}';
		var PUBLIC_PATH	 = '{PUBLIC_PATH}';
		var MODULE_NAME	 = '{MODULE_NAME}';
		var ACTION_NAME	 = '{ACTION_NAME}';
		var COOKIE_PRE = "$_FANWE['config']['cookie']['cookie_pre']";
		<!--{dynamic dynamicScript}-->
	</script>
	<!--{if isset($_FANWE['cache']['business']['taobao'])}-->
	<script src="http://a.tbcdn.cn/apps/top/x/sdk.js?appkey={$_FANWE['cache']['business']['taobao']['app_key']}"></script>
	<!--{/if}-->
    <style type="text/css">
	body{background:transparent;}
	</style>
</head>
<body>
	<!--{if $_FANWE['uid'] > 0}-->
	
    <!--{else}-->
    
    <!--{/if}-->
</body>
<?php
    $default_js = array();
	$default_js[] = './public/js/lang.js';
	$default_js[] = './public/js/setting.js';
	$default_js[] = './public/js/jquery.bgiframe.js';
	$default_js[] = './public/js/jquery.weebox.js';
	$default_js[] = './public/js/ajaxfileupload.js';
	$default_js[] = './public/js/swfobject.js';
?>
<script type="text/javascript" src="{script $default_js}" defer="true"></script>
<!--{dynamic getScript}-->
<script type="text/javascript">
jQuery(function($){
	var isCancel = true;
	var href = "{$href}";
	
	function postHandler(msg){
		var post = function(){
			if(window.postMessage)
				window.parent.postMessage(msg,"*");
			else
				window.name = msg;
		}
		setTimeout(post,1);
	}
	
	<!--{if $_FANWE['uid'] > 0}-->
	<!--{if $type == 'g'}-->
	$.Fast_Show_By_Type("{$goods}");
	function CloseFastShare(){
		FANWE.FAST_SHARE_CLOSE_FUNC = null;
		$.weeboxs.close();
		postHandler("close");
	}
	<!--{else}-->
	<!--{if $photo['status'] == 1}-->
	$.Fast_Show_By_Type(false,"{$photo['info']}");
	function CloseFastShare(){
		FANWE.FAST_SHARE_CLOSE_FUNC = null;
		$.weeboxs.close();
		postHandler("publish,p,2");
	}
	<!--{else}-->
	postHandler("publish,p,{$photo['status']}");
	<!--{/if}-->
	<!--{/if}-->
	FANWE.FAST_SHARE_CLOSE_FUNC = CloseFastShare;
	var pageImages;
	if(window.postMessage)
	{
		var messageHandler = function(event){
			event = event || window.event;
			pageImages = jQuery.parseJSON(event.data);
			window.addEventListener ? window.removeEventListener("message",messageHandler,false) : window.detachEvent("onmessage",messageHandler);
		}
		window.addEventListener ? window.addEventListener("message",messageHandler,false) : window.attachEvent("onmessage",messageHandler);
		window.parent.postMessage("getimgs","*");
	}
	<!--{else}-->
	FANWE.LOGIN_RESULT_FUNC = function(){
		clearTimeout(loginTimeout);
		ShouCheckLogin();
	};
	
	$.Show_Login_Form(false,function(){
		if(isCancel)
			postHandler("close");	
		else
			isCancel = true;
	});
	
	var pageIsActivity = true;
	var pageMoveTimeout;
	var loginTimeout;
	var pageActivityIsLogin = false;
	
	var ShouCheckLogin = function(){
		var query = new Object();
		query.url = href;
		
		$.ajax({
			url: SITE_PATH+"services/service.php?m=shou&a=init",
			data:query,
			dataType: "jsonp",
			success:function(result){
				var msg = '';
				if(result.uid == 0)
				{
					if(pageIsActivity)
					{
						loginTimeout = setTimeout(ShouCheckLogin,3000);
					}
					else
					{
						pageActivityIsLogin = true;
					}
					return false;
				}
				else if(result.goods == 1)
				{
					msg = "publish,g,"+result.status;
				}
				else
				{
					msg = "publish,p,"+result.status;
				}
				
				isCancel = false;
				$.weeboxs.close();
				clearTimeout(pageMoveTimeout);
				$("body").unbind('mousemove');
				var post = function(){
					if(window.postMessage)
						window.parent.postMessage(msg,"*");
					else
						window.name = msg;
				}
				setTimeout(post,1);
			}
		});
	}
	
	var ClearPageActivity = function(){
		pageIsActivity = false;
	}
	
	$("body").bind('mousemove',function(){
		clearTimeout(pageMoveTimeout);
		pageIsActivity = true;
		pageMoveTimeout = setTimeout(ClearPageActivity,30000);
		if(pageActivityIsLogin)
		{
			ShouCheckLogin();
			pageActivityIsLogin = false;	
		}
	});
	
	pageMoveTimeout = setTimeout(ClearPageActivity,30000);
	loginTimeout = setTimeout(ShouCheckLogin,3000);
	<!--{/if}-->
})
</script>
</html>